home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Games / NetHack 3.1.3 / source / include / wintty.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-01  |  6.6 KB  |  222 lines  |  [TEXT/R*ch]

  1. /*    SCCS Id: @(#)wintty.h    3.1    93/05/26          */
  2. /* Copyright (c) David Cohrs, 1991,1992                  */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #ifndef WINTTY_H
  6. #define WINTTY_H
  7.  
  8. #define E extern
  9.  
  10. #ifndef WINDOW_STRUCTS
  11. #define WINDOW_STRUCTS
  12.  
  13. /* descriptor for tty-based windows */
  14. struct WinDesc {
  15.     int flags;            /* window flags */
  16.     xchar type;            /* type of window */
  17.     boolean active;        /* true if window is active */
  18.     uchar offx, offy;        /* offset from topleft of display */
  19.     short rows, cols;        /* dimensions */
  20.     short curx, cury;        /* current cursor position */
  21.     short maxrow, maxcol;    /* the maximum size used -- for MENU wins */
  22.                 /* maxcol is also used by WIN_MESSAGE for */
  23.                 /* tracking the ^P command */
  24.     char **data;        /* window data [row][column] */
  25.     char *resp;            /* valid menu responses (for NHW_MENU) */
  26.     char *canresp;        /* cancel responses; 1st is the return value */
  27.     char *morestr;        /* string to display instead of default */
  28. };
  29.  
  30. /* window flags */
  31. #define WIN_CANCELLED 1
  32. #define WIN_STOP 1        /* for NHW_MESSAGE; stops output */
  33.  
  34. /* descriptor for tty-based displays -- all the per-display data */
  35. struct DisplayDesc {
  36.     uchar rows, cols;        /* width and height of tty display */
  37.     uchar curx, cury;        /* current cursor position on the screen */
  38. #ifdef TEXTCOLOR
  39.     int color;            /* current color */
  40. #endif
  41.     int attrs;            /* attributes in effect */
  42.     int toplin;            /* flag for topl stuff */
  43.     int rawprint;        /* number of raw_printed lines since synch */
  44.     int inmore;            /* non-zero if more() is active */
  45.     int inread;            /* non-zero if reading a character */
  46.     int intr;            /* non-zero if inread was interrupted */
  47.     winid lastwin;        /* last window used for I/O */
  48. };
  49.  
  50. #endif /* WINDOW_STRUCTS */
  51.  
  52. #define MAXWIN 20        /* maximum number of windows, cop-out */
  53.  
  54. /* tty dependent window types */
  55. #ifdef NHW_BASE
  56. #undef NHW_BASE
  57. #endif
  58. #define NHW_BASE    6
  59.  
  60. extern struct window_procs tty_procs;
  61.  
  62. /* port specific variable declarations */
  63. extern winid BASE_WINDOW;
  64.  
  65. extern struct WinDesc *wins[MAXWIN];
  66.  
  67. extern struct DisplayDesc *ttyDisplay;    /* the tty display descriptor */
  68.  
  69. extern char morc;        /* last character typed to xwaitforspace */
  70. extern char defmorestr[];    /* default --more-- prompt */
  71.  
  72. /* port specific external function references */
  73.  
  74. /* ### getline.c ### */
  75. E void FDECL(xwaitforspace, (const char *));
  76.  
  77. /* ### termcap.c ### */
  78.  
  79. E void FDECL(tty_startup,(int*, int*));
  80. #if defined(apollo)
  81. /* Apollos don't widen old-style function definitions properly -- they try to
  82.  * be smart and use the prototype, or some such strangeness.  So we have to
  83.  * define UNWIDENDED_PROTOTYPES (in tradstdc.h), which makes CHAR_P below a
  84.  * char.  But the tputs termcap call was compiled as if xputc's argument
  85.  * actually would be expanded.  So here, we have to make an exception. */
  86. E void FDECL(xputc, (int));
  87. #else
  88. E void FDECL(xputc, (CHAR_P));
  89. #endif
  90. E void FDECL(xputs, (const char *));
  91. E void NDECL(cl_end);
  92. E void NDECL(clear_screen);
  93. E void NDECL(home);
  94. E void NDECL(standoutbeg);
  95. E void NDECL(standoutend);
  96. # if 0
  97. E void NDECL(revbeg);
  98. E void NDECL(boldbeg);
  99. E void NDECL(blinkbeg);
  100. E void NDECL(dimbeg);
  101. E void NDECL(m_end);
  102. # endif
  103. E void NDECL(backsp);
  104. E void NDECL(graph_on);
  105. E void NDECL(graph_off);
  106. E void NDECL(cl_eos);
  107.  
  108. /*
  109.  * termcap.c (or facsimiles in other ports) is the right place for doing
  110.  * strange and arcane things such as outputting escape sequences to select
  111.  * a color or whatever.  wintty.c should concern itself with WHERE to put
  112.  * stuff in a window.
  113.  */
  114. E void FDECL(term_start_attr,(int attr));
  115. E void FDECL(term_end_attr,(int attr));
  116. E void NDECL(term_start_raw_bold);
  117. E void NDECL(term_end_raw_bold);
  118.  
  119. #ifdef TEXTCOLOR
  120. E void NDECL(term_end_color);
  121. E void FDECL(term_start_color,(int color));
  122. E int FDECL(has_color,(int color));
  123. #endif /* TEXTCOLOR */
  124.  
  125.  
  126. /* ### topl.c ### */
  127.  
  128. E void FDECL(addtopl, (const char *));
  129. E void NDECL(more);
  130. E void FDECL(update_topl, (const char *));
  131. E void FDECL(putsyms, (const char*));
  132.  
  133. /* ### wintty.c ### */
  134. #ifdef CLIPPING
  135. E void NDECL(setclipped);
  136. #endif
  137. E void FDECL(docorner, (int, int));
  138. E void NDECL(end_glyphout);
  139. E void FDECL(g_putch, (int));
  140. E void NDECL(win_tty_init);
  141.  
  142. /* external declarations */
  143. E void NDECL(tty_init_nhwindows);
  144. E void NDECL(tty_player_selection);
  145. E void NDECL(tty_askname);
  146. E void NDECL(tty_get_nh_event) ;
  147. E void FDECL(tty_exit_nhwindows, (const char *));
  148. E void FDECL(tty_suspend_nhwindows, (const char *));
  149. E void NDECL(tty_resume_nhwindows);
  150. E winid FDECL(tty_create_nhwindow, (int));
  151. E void FDECL(tty_clear_nhwindow, (winid));
  152. E void FDECL(tty_display_nhwindow, (winid, BOOLEAN_P));
  153. E void FDECL(tty_dismiss_nhwindow, (winid));
  154. E void FDECL(tty_destroy_nhwindow, (winid));
  155. E void FDECL(tty_curs, (winid,int,int));
  156. E void FDECL(tty_putstr, (winid, int, const char *));
  157. E void FDECL(tty_display_file, (const char *, BOOLEAN_P));
  158. E void FDECL(tty_start_menu, (winid));
  159. E void FDECL(tty_add_menu, (winid, CHAR_P, int, const char *));
  160. E void FDECL(tty_end_menu, (winid, CHAR_P, const char *, const char *));
  161. E char FDECL(tty_select_menu, (winid));
  162. E void NDECL(tty_update_inventory);
  163. E void NDECL(tty_mark_synch);
  164. E void NDECL(tty_wait_synch);
  165. #ifdef CLIPPING
  166. E void FDECL(tty_cliparound, (int, int));
  167. #endif
  168. E void FDECL(tty_print_glyph, (winid,XCHAR_P,XCHAR_P,int));
  169. E void FDECL(tty_raw_print, (const char *));
  170. E void FDECL(tty_raw_print_bold, (const char *));
  171. E int NDECL(tty_nhgetch);
  172. E int FDECL(tty_nh_poskey, (int *, int *, int *));
  173. E void NDECL(tty_nhbell);
  174. E int NDECL(tty_doprev_message);
  175. E char FDECL(tty_yn_function, (const char *, const char *, CHAR_P));
  176. E void FDECL(tty_getlin, (const char *,char *));
  177. #ifdef COM_COMPL
  178. E void FDECL(tty_get_ext_cmd, (char *));
  179. #endif /* COM_COMPL */
  180. E void FDECL(tty_number_pad, (int));
  181. E void NDECL(tty_delay_output);
  182. #ifdef CHANGE_COLOR
  183. E void FDECL(tty_change_color,(int color,long rgb,int reverse));
  184. E char * NDECL(tty_get_color_string);
  185. #endif
  186.  
  187. /* other defs that really should go away (they're tty specific) */
  188. E void NDECL(tty_start_screen);
  189. E void NDECL(tty_end_screen);
  190.  
  191. E void FDECL(genl_outrip, (winid,int));
  192. #undef E
  193.  
  194. #ifdef NO_TERMS
  195. # ifdef MAC
  196. #  ifdef putchar
  197. #   undef putchar
  198. #   undef putc
  199. #  endif
  200. #  define putchar term_putc
  201. #  define putc term_fputc
  202. #  define fputc term_fputc
  203. #  define fflush term_flush
  204. #  define fputs term_fputs
  205. #  define puts term_puts
  206. #  define printf term_printf
  207. #  define fprintf fterm_printf
  208. # endif
  209. # if defined(MSDOS) || defined(WIN32CON)
  210. #  if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST)
  211. #   undef putchar
  212. #   undef putc
  213. #   undef puts
  214. #   define putchar(x) xputc(x)  /* video.c, nttty.c */
  215. #   define putc(x) xputc(x)     
  216. #   define puts xputs           
  217. #  endif
  218. # endif
  219. #endif
  220.  
  221. #endif /* WINTTY_H */
  222.